<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>JS while demo</title>
  </head>
  <body>
    <script type="text/javascript">
      /*var i=0,result=0;
      while(i<=100){
        result += i;
        i++;
      }
      console.log("1+2+3+4+5...+100="+result);


      var x = 0;
      while (x < 5) {
        console.log("这是"+(x+1)+"次循环");  //(x+1)就能进行加减运算了
        x++;
      }*/
    </script>

    <script type="text/javascript">
      var i=1;
      do{
        console.log("我就执行"+i+"次");
      }while(i<1)

    </script>


  </body>
</html>
